<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/tabs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript">
	var ACTION_POLICE_URL="${ctx}/house_coWorkerPoliceAction.do?";
	var ACTION_STREET_URL="${ctx}/house_coWorkerStreetAction.do?";
	var ACTION_RESIDENT_URL="${ctx}/house_coWorkerResidentAction.do?";

	//查询响应
	function searchCoWorker(){
	//	alert($('fsearch').action);
		$('fsearch').submit();
	}

	//当改变变页签时,将触发本方法,修改查询的action
	function changeURL(url){
		$('fsearch').action=url+"method=listCoWorker";
	}

	function init(){
		$('fsearch').action=ACTION_POLICE_URL+"method=listCoWorker";

	}

	//重新加载列表页面,不保留条件的刷新
	function reLoadIFrameList(){
		$('fsearch').reset();
		searchCoWorker();
	}

	//重新加载列表页面,保留查询条件的刷新
	function reLoadIFrameListWithQuery(){
		window.frames("coworkerList").freshFrame();
	}

	//获取当前选择的记录
	function getCoWorkerId(){
		return window.frames("coworkerList").getCoWorkerId();
	}


	//弹出删除协作伙伴提示窗口
	function showDelete(){
		if(getCoWorkerId()==""){
			ErrorAlert('${key.tipsByDelete}');
		}else{
			AlarmConfirm('${key.tipsByDeleteConfirm}',"main","deletePolice");
		}
	}
	//执行删除
	function deletePolice(){
		var url=ACTION_POLICE_URL + "method=deleteCoWorker&coWorkerId="+getCoWorkerId();
		var myAjax = new Ajax.Request(
	                   url,
	                   {method: 'post', parameters:"" , onComplete: showResponseDelete}
	                   );
	}
	//删除响应
	function showResponseDelete(transport){
		ajaxSubmitException(transport.responseText);
		if(transport.responseText=="false"){
			FailureAlert('${key.doFalse}');
		}else{
			reLoadIFrameListWithQuery();
		}
	}

	//派出所
	function openNewPoliceWindow(){
		var url=ACTION_POLICE_URL + "method=initCoWorkerAdd";
		top.windowOpen(url, 'newDevloper', '${key.addPolice}', 300,440,true,'editCoworkerFrame');
	}

	function openEditPoliceWindow(){
		if(getCoWorkerId()==""){
			ErrorAlert('${key.tipsByModify}');
		}else{
			var url=ACTION_POLICE_URL + "method=initCoWorkerEdit&coWorkerId="+getCoWorkerId();
			top.windowOpen(url, 'newPolice', '${key.modifyPolice}', 300,440,true,'editCoworkerFrame');
		}
	}
	//街道办
	function openNewStreetWindow(){
		var url=ACTION_STREET_URL + "method=initCoWorkerAdd";
		top.windowOpen(url, 'newDevloper', '${key.addStreet}', 300,440,true,'editCoworkerFrame');
	}

	function openEditStreetWindow(){
		if(getCoWorkerId()==""){
			ErrorAlert('${key.tipsByModify}');
		}else{
			var url=ACTION_STREET_URL + "method=initCoWorkerEdit&coWorkerId="+getCoWorkerId();
			top.windowOpen(url, 'newStreet', '${key.modifyStreet}', 300,440,true,'editCoworkerFrame');
		}
	}

	//居委会
	function openNewResidentWindow(){
		var url=ACTION_RESIDENT_URL + "method=initCoWorkerAdd";
		top.windowOpen(url, 'newResident', '${key.addResident}', 300,440,true,'editCoworkerFrame');
	}

	function openEditResidentWindow(){
		if(getCoWorkerId()==""){
			ErrorAlert('${key.tipsByModify}');
		}else{
			var url=ACTION_RESIDENT_URL + "method=initCoWorkerEdit&coWorkerId="+getCoWorkerId();
			top.windowOpen(url, 'newResident', '${key.modifyResident}', 300,440,true,'editCoworkerFrame');
		}
	}

	function clearSearch(){
		$('name').value="";
		$('contactor').value="";
	}

</script>

</head>
<body onKeyDown="CommonKey()" oncontextmenu="return HideContextMenu_right()" onload="init();">
<div style="overflow:auto; height:500px;">
<form id="fsearch" action="" target="coworkerList" method="post">
<div class="pageNav_bg">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td id="pageNav_leftimg"><img src="${ctx}/images/ico_fc_zhengfu.gif"
			width="46" height="47" /></td>
		<td id="navWord"><span class="page_title">${key.page_title}</span></td>
		<td class="pageNav_right"><a href="javascript:showFull_in();"><img
			id="full_image" src="${ctx}/images/ico_fullscreen.gif" border="0" /></a></td>
	</tr>
</table>
</div>
<div class="container">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td>
		<!-----------------------------搜索1----------------------------->
		<table width="100%" border="0" cellpadding="0" cellspacing="0"
			id="search01" class="bg_search">
			<tr>
				<td>
				<table border="0" cellpadding="0" cellspacing="1">
					<tr>
						<td class="grid align_left">${key.name}：</td>
						<td class="grid align_left"><input name="name"
							type="text" class="inputtext" size="16" /></td>
						<td class="grid align_left">${key.contactor}：</td>
						<td class="grid align_left"><input name="contactor"
							type="text" class="inputtext" size="16" /></td>
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	  <td class="td_search">
		  	<table border="0" cellpadding="0" cellspacing="0">
            	<tr>
              	<td class="buttonOffLeft" id="btn1_11"></td>
              	<td class="buttonOffMiddle" id="btn1_12" onblur="btn_change(1)" onMouseOver="btn_change_over(1)" onMouseOut="btn_change_out(1)" onclick="searchCoWorker();"><img src="${ctx}/images/ico_searchico.gif" alt="" border="0" align="absmiddle"> 查询</td>
      	        <td class="buttonOffRight" id="btn1_13"></td>
				</tr>
          	</table>
          </td>
						<td>
						<table border="0" cellpadding="0" cellspacing="0">

						</table>
						</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		<!--------------------------右边图标:派出所----------------------------------->
		<div id="rightPolice">
		<table border="0" cellpadding="0" cellspacing="0" id="ico1">
			<tr>
				<td class="toolbarico"><a href="#" onclick="openNewPoliceWindow();"
					onfocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif"
					border="0" align="absbottom" alt="${key.add}" />&nbsp;</a></td>
				<td class="toolbarico"><a href="#" onFocus="this.blur()"
					onClick="openEditPoliceWindow();"><img src="${ctx}/images/ico_amend.gif" alt="${key.modify}"
					width="16" height="16" border="0" align="absbottom" /></a></td>
				<td class="toolbarico"><a href="#" onClick="showDelete();"
					onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif"
					alt="${key.delete}" width="16" height="16" border="0" align="absbottom"></a></td>

				<td class="toolbarico">&nbsp;</td>
			</tr>
		</table>
		</div>
		<!--------------------------右边图标:街道办----------------------------------->
		<div id="rightStreet">
		<table border="0" cellpadding="0" cellspacing="0" id="ico1">
			<tr>
				<td class="toolbarico"><a href="#" onclick="openNewStreetWindow();"
					onfocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif"
					border="0" align="absbottom" alt="${key.add}" />&nbsp;</a></td>
				<td class="toolbarico"><a href="#" onFocus="this.blur()"
					onClick="openEditStreetWindow();"><img src="${ctx}/images/ico_amend.gif" alt="${key.modify}"
					width="16" height="16" border="0" align="absbottom" /></a></td>
				<td class="toolbarico"><a href="#" onClick="showDelete()"
					onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif"
					alt="${key.delete}" width="16" height="16" border="0" align="absbottom"></a></td>

				<td class="toolbarico">&nbsp;</td>
			</tr>
		</table>
		</div>
		<!--------------------------右边图标:居委会----------------------------------->
		<div id="rightResident">
		<table border="0" cellpadding="0" cellspacing="0" id="ico1">
			<tr>
				<td class="toolbarico"><a href="#" onclick="openNewResidentWindow();"
					onfocus="this.blur()"><img src="${ctx}/images/ico_newfile.gif"
					border="0" align="absbottom" alt="${key.add}" />&nbsp;</a></td>
				<td class="toolbarico"><a href="#" onFocus="this.blur()"
					onClick="openEditResidentWindow();"><img src="${ctx}/images/ico_amend.gif" alt="${key.modify}"
					width="16" height="16" border="0" align="absbottom" /></a></td>
				<td class="toolbarico"><a href="#" onClick="showDelete()"
					onFocus="this.blur()"><img src="${ctx}/images/ico_delete.gif"
					alt="${key.delete}" width="16" height="16" border="0" align="absbottom"></a></td>

				<td class="toolbarico">&nbsp;</td>
			</tr>
		</table>
		</div>
		<!--------列表页面---->
		<pms:tabPanel panelId="developer" hasTop="false"
			iframeId="coworkerList" defaultHeight="400px">

			<pms:tab tabId="coworkerPoliceList"
				baseUrl="${ctx}/house_coWorkerPoliceAction.do?method=initCoWorkerList"
				caption="${key.police}" rightDiv="rightPolice" afterFunction="changeURL(ACTION_POLICE_URL);clearSearch();">
			</pms:tab>

			<pms:tab tabId="coWorkerStreetList"
				baseUrl="${ctx}/house_coWorkerStreetAction.do?method=initCoWorkerList"
				afterFunction="changeURL(ACTION_STREET_URL);clearSearch();"
				caption="${key.street}"  rightDiv="rightStreet">
			</pms:tab>

			<pms:tab tabId="coWorkerResidentList"
				baseUrl="${ctx}/house_coWorkerResidentAction.do?method=initCoWorkerList"
				afterFunction="changeURL(ACTION_RESIDENT_URL);clearSearch();"
				caption="${key.resident}"  rightDiv="rightResident">
			</pms:tab>

		</pms:tabPanel>

		<!------------------------------------------------------------->
	</tr>
</table>
</td>
</tr>
</form>
</div>
</body>
</html>
